home *** CD-ROM | disk | FTP | other *** search
- --------------------------------------------------------------------------------
- -- Weapon Pogo Stick
- -- Original Carnage Contest Weapon
- -- Script by DC, August 2009, www.UnrealSoftware.de
- --------------------------------------------------------------------------------
-
- -- Setup Tables
- if cc==nil then cc={} end
- cc.pogostick={}
-
- -- Load & Prepare Ressources
- cc.pogostick.gfx_wpn=loadgfx("weapons/pogostick.bmp") -- Weapon Image
- setmidhandle(cc.pogostick.gfx_wpn)
- cc.pogostick.sfx_attack=loadsfx("pogostick.ogg") -- Attack Sound
-
- --------------------------------------------------------------------------------
- -- Weapon: Pogo Stick
- --------------------------------------------------------------------------------
-
- cc.pogostick.id=addweapon("cc.pogostick","Pogo Stick",cc.pogostick.gfx_wpn,1) -- Add Weapon (1 use)
-
-
- function cc.pogostick.draw() -- Draw
- if weapon_mode==1 then
- -- Draw
- setblend(blend_alpha)
- setalpha(1)
- setcolor(255,255,255)
- setscale(-getplayerdirection(0),1)
- setrotation(0)
- drawimage(cc.pogostick.gfx_wpn,getplayerx(0),getplayery(0)+8)
- hudinfo("Hit [Space] again to deactivate the pogo stick!")
- elseif weapon_shots==0 then
- hudinfo("Hit [Space] once to activate the pogo stick!")
- end
- end
-
- function cc.pogostick.attack(attack) -- Attack
- if weapon_timer>0 then
- weapon_timer=weapon_timer-1
- end
- -- Activate / Deactive
- if (attack==1) and weapon_timer<=0 then
- weapon_timer=10
- if weapon_shots==0 then
- weapon_mode=1
- weapon_shots=1
- useweapon(1)
- else
- weapon_mode=0
- end
- end
- -- Super Jump Power!
- if (weapon_mode==1) then
- -- Pogo Jump
- if getplayeraction(0)==0 then
- playerpush(0,getplayerdirection(0)*1.0,-7.0,1,0)
- playsound(cc.pogostick.sfx_attack)
- end
- -- Avoid Falldamage
- if getplayeryspeed(0)>7.0 then
- playerpush(0,getplayerxspeed(0),7.0,1,0)
- end
- -- Timeout (disable stick)
- if getframesleft()<=1 then
- weapon_mode=2
- end
- end
- end
-